<template>
  <el-card class="refs">
    <div v-for="item in outputList" :key="item" class="text item">
      <a v-show="item.str !== '暂无相关信息'" :href="jumpToOtherPaperUrl(item.paperId)" class="refText">{{item.str}}</a>
      <p v-show="item.str === '暂无相关信息'"  class="refText">暂无相关信息</p>

    </div>

  </el-card>

</template>

<script>
export default {
  name: "DetailBottomTabsItem",
  props: ['itemList'],
  computed: {

    outputList() {
      let list = []

      for (let index = 0; index<this.itemList.length; index++) {
        let str = ''
        str = '['+(index+1)+']'
        if (this.itemList.at(index).authors.length === 0) {
          str += '作者不详.'
        }
        else {
          for (let index2 = 0; index2<this.itemList.at(index).authors.length; index2++) {
            str += this.itemList.at(index).authors.at(index2)+','
          }
          str = str.substr(0,str.length-1)+".\n\n"
        }

        str += this.itemList.at(index).title

        let data = {
          str: str,
          paperId: this.itemList.at(index).paperId
        }
        list.push(data)
      }

      console.log(list);
      if (list.length === 0) {
        console.log('此处ret')
        return [{
          str: '暂无相关信息',
          paperId: -1
        }]
      }
      return list
    },
  },

  methods: {
    jumpToOtherPaperUrl(paperId) {
      return '/detail?paperId='+paperId
    }
  }
}
</script>

<style scoped>

.refs {
}

.refText {
  font-size: medium;
}

</style>